<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="__PUBLIC__/admin/assets/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="__PUBLIC__/admin/css/style.css" />
<link rel="stylesheet" href="__PUBLIC__/admin/assets/css/ace.min.css" />
<link rel="stylesheet" href="__PUBLIC__/admin/assets/css/font-awesome.min.css" />
<link href="__PUBLIC__/admin/Widget/icheck/icheck.css" rel="stylesheet" type="text/css" />
<!--[if IE 7]>
		  <link rel="stylesheet" href="__PUBLIC__/admin/assets/css/font-awesome-ie7.min.css" />
		<![endif]-->
<!--[if lte IE 8]>
		  <link rel="stylesheet" href="__PUBLIC__/admin/assets/css/ace-ie.min.css" />
		<![endif]-->
<script src="__PUBLIC__/admin/js/jquery-1.9.1.min.js"></script>
<script src="__PUBLIC__/admin/assets/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="__PUBLIC__/admin/css/yagamizn.css" />
<title>添加车系分类</title>
</head>
<body>
	<div class="type_style">
		<div class="type_title">车系类型信息</div>
		<div class="type_content">
			<!--<div class="Operate_btn">
				<a href="javascript:ovid()" class="btn  btn-warning"><i
					class="icon-edit align-top bigger-125"></i>新增子类型</a> <a
					href="_javascript:ovid()" class="btn  btn-success"><i
					class="icon-ok align-top bigger-125"></i>禁用该类型</a> <a
					href="javascript:ovid()" class="btn  btn-danger"><i
					class="icon-trash   align-top bigger-125"></i>删除该类型</a>
			</div>-->
			<form action="" method="post" class="form form-horizontal"
				id="form-user-add">
				<div class="Operate_cont clearfix">
					<label class="form-label"><span class="c-red">*</span>选择品牌：</label>
					<div>
						<select class="brand-select" autofocus="autofocus" name='brand' onmousedown="if(this.options.length>10){this.size=5}" onblur="this.size=0" onchange="this.size=0">
							{volist name="brandList" id="data"}
							{if condition="$data.pid eq 0"}
							<option value="{$data.id}">{$data.name}</option>
							{/if}
							{/volist}
						</select>
					</div>
				</div>
				<div class="Operate_cont clearfix">
					<label class="form-label"><span class="c-red">*</span>分类名称：</label>
					<div class="formControls ">
						<input type="text" class="input-text" value="{:isset($cateone.name)?$cateone.name:''}" placeholder=""
							id="user-name" name="name">
					</div>
				</div>
				<div class="Operate_cont clearfix">
					<label class="form-label"><span class="c-red">*</span>排序：</label>
					<div class="formControls ">
						<input type="text" class="input-text" value="{:isset($cateone.rank)?$cateone.rank:''}" placeholder=""
							id="user-name" name="rank" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();">
					</div>
				</div>
				<div class="Operate_cont clearfix">
					<label class="form-label">备注：</label>
					<div class="formControls">
						<textarea name="mark" rows="" class="textarea"
							placeholder="说点什么...最少输入10个字符" datatype="*10-100"
							dragonfly="true" nullmsg="备注不能为空！"
							onKeyUp="textarealength(this,100)">{:isset($cateone.text)?$cateone.text:''}</textarea>
						<p class="textarea-numberbar">
							<em class="textarea-length">0</em>/100
						</p>
					</div>
				</div>
				<div class="Operate_cont clearfix">
					<label class="form-label">显示状态：</label>
						<label><input name="isdisplay" type="radio" class="ace"
							checked="checked" value='1'><span class="lbl">显示</span></label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<label><input type="radio" class="ace" name="isdisplay" value='0'><span
								class="lbl">不显示</span></label>
				</div>
				<div class="">
					<div class="" style="text-align: center">
						<input class="btn btn-primary radius" id="cartypeSave" type="submit" value="提交">
					</div>
				</div>
			</form>
		</div>
	</div>
	</div>
	<script type="text/javascript" src="__PUBLIC__/admin/Widget/icheck/jquery.icheck.min.js"></script>
	<script type="text/javascript"
		src="__PUBLIC__/admin/Widget/Validform/5.3.2/Validform.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/admin/assets/layer/layer.js"></script>
	<script type="text/javascript" src="__PUBLIC__/admin/js/H-ui.js"></script>
	<script type="text/javascript" src="__PUBLIC__/admin/js/H-ui.admin.js"></script>
	<script type="text/javascript">
		//默认选中
		{if condition='isset($cateone.pid)'}
		$("[name=brand] option[value='{$cateone.pid}']").prop('selected','selected');
		{/if}
		$(function() {
			$('.skin-minimal input').iCheck({
				checkboxClass : 'icheckbox-blue',
				radioClass : 'iradio-blue',
				increaseArea : '20%'
			});

			$("#form-user-add").Validform({
				tiptype : 2,
				callback : function(form) {
					form[0].submit();
					var index = parent.layer.getFrameIndex(window.name);
					parent.$('.btn-refresh').click();
					parent.layer.close(index);
				}
			});
		});
		$("#cartypeSave").click(function(){
			var name=$("[name=name]").val();
			var rank=$("[name=rank]").val();
			var brand=$("[name=brand]").val();
			var mark=$("[name=mark]").val();
			var isDisplay=$("input[name='isdisplay']:checked").val();
			if(name.length==0||rank.length==0||brand.length==0){
				layer.msg("*为必填项",{  icon:0, });
			}else{
				$.ajax({
					type:"post",
					url:"{:url('Category/categorySave')}",
					{if condition='isset($cateone.pid)'}
					data:{name:name,rank:rank,brand:brand,mark:mark,isdisplay:isDisplay,id:{$cateone.id}},
					{else /}
					data:{name:name,rank:rank,brand:brand,mark:mark,isdisplay:isDisplay},
					{/if}
					success:function(jsonData,status){
						if(jsonData.code==200){
							layer.msg(jsonData.msg, { icon: 1, time: 2000 },function(){
							window.location.reload(true);
							});
						}else if(jsonData.code==300){
							layer.alert(jsonData.msg,{  icon:0, });
						}else if(jsonData.code==400){
							layer.alert(jsonData.msg,{  icon:2, });
						}
					}
				});
			}
		});
	</script>
</body>
</html>